<style lang="less">
    @import '../../styles/common.less';
    @import '../tables/components/table.less';
</style>
<template>
    <div>
        <form action="" style="margin: 5px 0">
            <Input v-model="userName"  placeholder="管理员名称" @on-click="" style="width: 200px;margin-right: 3px;"></Input>
            <Input v-model="phone"  placeholder="管理员手机号" @on-click="" style="width: 200px;margin-right: 3px;"></Input>
            <div style="float: right">
                <Button type="success" style="float: right;margin-right: 5px" @click="load">查询</Button>
            </div>
        </form>
        <Table :loading="loading" refs="table1" @on-selection-change="changeNum" @on-delete="handleDel" :data="Message" :columns="columnsList"></Table>
        <Page :total="pageNum" :page-size="pageSize"  style="text-align: center;margin-top: 15px;" show-total @on-page-size-change='pageSizes'  show-elevator show-sizer @on-change="pageChange"></Page>
    </div>
</template>
<script>
    import $http from '../../utils/axiosWrap'
    import canEditTable from '../tables/components/canEditTable.vue'
    import Cookies from 'js-cookie'

    export default {
        data() {
            return {
                loading: true,
                Message:[],
                admin:true,
                columnsList: [
                    {
                        title: '序号',
                        width: 80,
                        align: 'center',
                        render: (h, params) => {
                            return  params.index + (this.initPage- 1) * this.pageSize + 1
                        }
                    },
                    {
                        title: '管理员名',
                        align: 'center',
                        key: 'sysUser',
                        editable: true
                    },
                    {
                        title: 'ip',
                        align: 'center',
                        key:'ip',
                    },
                    {
                        title: '地址',
                        align: 'center',
                        key:'address'

                    },
                    {
                        title: '时间',
                        align: 'center',
                        width:'auto',
                        editable: true,
                        key:'createTime'
                    },
                ],
                userName: '',
                phone: '',
                pageNum:0,
                pageSize:10,
                initPage:1
            }
        },
        created: function () {
            this.load()
            var time
            time = new Date()
            console.log(time)

        },
        methods: {
            handleDel (val, index) {
                this.$Message.success('删除了第' + (index + 1) + '行数据');
            },
            pageSizes(val){
                this.pageSize = val
                this.load()
            },
            load (){
                let _this = this
                let params = new URLSearchParams()
                params.append('pno',_this.initPage)
                params.append('pageSize',_this.pageSize)
                params.append('userName',_this.userName)
                params.append('phone',_this.phone)

                $http.post('/sysManagerUser/selectSysLoginLogPage',params).then(function (res) {
                    _this.Message = res.result.list
                    _this.pageNum = res.result.totalRow
                    _this.loading = false
                    if(!res.suc){
                        if(res.msg == "请先登录"){
                            _this.$Message.error('请重新登录！');
                        }else{
                            _this.$Message.error(res.msg);
                        }
                    }

                })
            },
            changeNum (val){
                console.log(val)
            },
            info(val){
                this.modal1 = true
                this.userListInner = val.row
            },
            cancel(){
//                this.$Message.info('Clicked cancel');
            },
            pageChange(index){
                this.initPage = index
                this.loading = true
                this.load ()
            }
        }
    }
</script>
<style>
    .userListInfo{
        display: inline-block;
        width: 120px;
    }
    .userListInfoWrap p{
        line-height: 26px;
    }
</style>

